#!/usr/bin/env python3
# -*- coding: utf-8 -*-

from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
import os

# ROOT Path
ROOT_PATH = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

# CONFIG PATH
CONFIG_PATH = os.path.join(ROOT_PATH, "Config")
PAGE_PROPERTY_PATH = os.path.join(CONFIG_PATH, "PageProperty.json")

# BACKUP PATH
BACKUP_PATH = os.path.join(ROOT_PATH, "Backup")

# RESULTS PATH
RESULTS_PATH = os.path.join(ROOT_PATH, "Results")
RESULTS_LOGS_PATH = os.path.join(RESULTS_PATH, "Logs")
RESULTS_SCREENSHOTS_PATH = os.path.join(RESULTS_PATH, "Screenshots")
RESULTS_SEARCHRESULTS_PATH = os.path.join(RESULTS_PATH, "SearchResults")

# DRIVER PATH
DRIVER_PATH = os.path.join(ROOT_PATH, "Drivers")
CHROME_DRIVER_PATH = os.path.join(DRIVER_PATH, "ChromeDriver", "chromedriver.exe")
FIREFOX_DRIVER_PATH = os.path.join(DRIVER_PATH, "FirefoxDriver", "geckodriver.exe")
IE_DRIVER_PATH = os.path.join(DRIVER_PATH, "IEDriver", "IEDriverServer.exe")
SELENIUM_GRID_PATH = os.path.join(DRIVER_PATH, "SeleniumGrid", "selenium-server-standalone-3.9.1.jar")

# BROWSER ENGINE
TESTSUITE_PATH = os.path.join(ROOT_PATH, "TestSuite")
LOCAL_BROWSER_NAME = "Chrome"    # Chrome/Firefox/IE
REMOTE_SWITCH = True    # True/False
REMOTE_HOST_INFO = {
    "REMOTE1": {
        "HOST_NAME": r"http://192.168.98.106:5555/wd/hub",
        "REMOTE_BROWSER_DESIRED_CAPABILITIES": DesiredCapabilities.FIREFOX,
    },
    "REMOTE2": {
        "HOST_NAME": r"http://192.168.98.106:5556/wd/hub",
        "REMOTE_BROWSER_DESIRED_CAPABILITIES": DesiredCapabilities.FIREFOX,
    },
}

# Time Settings
WAIT_PAGELOADED_TIMEOUT = 60
WAIT_IMPLICITY_TIMEOUT = 10
WAIT_UNTIL_TIMEOUT = 5
WAIT_UNTIL_NOT_TIMEOUT = 5
WAIT_FREQUENCY = 0.5
ACTOYS_SEARCH_FORCE_WAIT = 17

# Operation Attempt
OPERATION_ATTEMPT = 5

if __name__ == "__main__":
    print('root_path = {0}'.format(str(os.path.exists(ROOT_PATH))))
    print('config_path = {0}'.format(str(os.path.exists(CONFIG_PATH))))
    print('page_property_path = {0}'.format(str(os.path.exists(PAGE_PROPERTY_PATH))))
    print('results_path = {0}'.format(str(os.path.exists(RESULTS_PATH))))
    print('log_file_path = {0}'.format(str(os.path.exists(RESULTS_LOGS_PATH))))
    print('taken_screenshots_path = {0}'.format(str(os.path.exists(RESULTS_SCREENSHOTS_PATH))))
    print('search_results_path = {0}'.format(str(os.path.exists(RESULTS_SEARCHRESULTS_PATH))))
    print('driver_path = {0}'.format(str(os.path.exists(DRIVER_PATH))))
    print('chrome_driver_path = {0}'.format(str(os.path.exists(CHROME_DRIVER_PATH))))
    print('firefox_driver_path = {0}'.format(str(os.path.exists(FIREFOX_DRIVER_PATH))))
    print('selenium_grid_path = {0}'.format(str(os.path.exists(SELENIUM_GRID_PATH))))
    print('backup_path = {0}'.format(str(os.path.exists(BACKUP_PATH))))
    print('testsuite_path = {0}'.format(str(os.path.exists(TESTSUITE_PATH))))
